{% extends "base.html" %}

{%block header_js %}
<script type="text/javascript" src="/static/js/validation.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $.get("/strategy/ajax_get_tpl/?tpl={{strategy.tpl}}&id={{strategy.id}}", function(data){
                $("#tpl_contain").html(data);
    });

    $(".tpl").change(
        function() {
            $("#tpl_submit").show();
            var selectTpl = $("input[name='tpl']:checked").val();
            $.get("/strategy/ajax_get_tpl/?id={{strategy.id}}&tpl="+ selectTpl, function(data){
                $("#tpl_contain").html(data);
            });
        });
    });
</script>

{% endblock %}

<body>
{% block header %}
{% include "strategy-menu.html" %}
{% endblock %}

{% block content %}
<div class="wrap">
{% include "tree.html" %}
    <div class="wrap_left right">
		<div class="shenqing1">
		<h5 style="float:left;width:96%;margin-bottom:10px;">创建策略</h5>
	</div>
    <div class="caozuo_add">
    	<form acthon="/strategy/add/" method="post">
        <div class="box">
            <div class="row">
                <label class="">策略ID:</label>
                <input type="text" name="id" class="word_in boxinput" value="{{strategy.id}}" readonly="readonly"/>
            </div>
            <div class="row">
                <label class="">策略名称:</label>
                <input id="name" type="text" name="name" class="word_in boxinput" value="{{strategy.name}}"/>
            	<span id="nameInfo">请给策略起一个名字。长度为10。</span>
            </div>
            <div class="row">
                <label class="">策略描述:</label>
                <input id="texts" type="text" name="detail" class="word_in boxinput" value="{{strategy.detail}}"/>
                <span id="textsInfo">对策略进行简单描述。</span>
            </div>
            <div class="row">
                <label class="">模版名称:</label>
                {% for t in tpl %}
                    {% if t == strategy.tpl %}
					{{ t }}&nbsp;<input name="tpl" class="tpl" type="radio" value="{{ t}}" checked=true />&nbsp;&nbsp;&nbsp;
                    {% else %}
					{{ t }}&nbsp;<input name="tpl" class="tpl" type="radio" value="{{ t}}" />&nbsp;&nbsp;&nbsp;
                    {% endif %}
	            {% endfor %}
            </div>
            <div id="tpl_contain" class="row">
            
            </div>
        </div>
        <input id="tpl_submit" type="submit" class="tijiao_big" value="&nbsp;提交" /></td>
		</table>
	</div>
</div>
{% endblock %}

</body>
</html>
